<template>
	<view style="width: 750rpx;box-sizing: border-box;height: 100%;">
		<scroll-view style="height: 1200rpx;width: 750rpx;padding-top: 20rpx;" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
			:refresher-threshold="0" refresher-background="#ffffff" @refresherpulling="onPulling" @refresherrefresh="onRefresh" :scroll-top="scrollTop"  @scrolltolower="scrolltolower">
			<view v-for="(itme,index) in teacher_arr" :key="index" style="width: 694.6rpx;height: 156rpx;background: #FFFFFF;border-radius: 24.15rpx;margin-bottom: 12.684rpx;box-sizing: border-box;padding: 31.4rpx 27.18rpx;display: flex;justify-content: space-between;align-items: center;margin-left: 30rpx;border: #BEBEBE 1rpx solid;" @tap="xiugai(itme)">
				<view style="display: flex;overflow: hidden;">
					<view>
						<image :src="itme.photo" style="width: 93rpx;height: 93rpx;border-radius: 50%;"></image>
					</view>
					<view style="font-size: 30rpx;margin:4rpx 0 0 28.4rpx;">
						<view style="color: #383838;font-weight: bold;margin-bottom: 8rpx;">{{itme.full_name}}</view>
						<view style="color: #BFBFBF;">{{itme.mobile}}</view>
					</view>
				</view>
				<view>
					<image src="../../../static/newshouye/zhishijian_.png" style="width: 16.3rpx;height: 24.15rpx;margin-left: 12rpx;vertical-align: middle;"></image>
				</view>
			</view>
		</scroll-view>
		<view  style="width: 694.6rpx;height: 100rpx;background: #FFFFFF;border-radius: 24.15rpx;position: fixed;left: 27.77rpx;bottom: 40rpx;display: flex;justify-content: center;align-items: center;" @tap="go_tianjia">
			<view>
				<image src="../../../static/newshouye/shizijia.png" style="width: 25.36rpx;height: 25.36rpx;"></image>
				<text style="font-size: 30rpx;color: #383838;margin-left: 15rpx;">
					添加老师
				</text>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data(){
			return {
				mechanism_id: "",
				currentPage: 1,
				teacher_arr: [],
				numb:1,
				triggered:false,
				panduan_num: 1
			}
		},
		methods:{
				onRefresh(){
					this.currentPage = 1
					this.panduan_num = 2
					this.teacher_arr = []
					this.teacher_list()
				},
				xiugai(itme){
					uni.navigateTo({
						url:"/pages/Friend/selectindex/selectindex?num=" + encodeURIComponent(JSON.stringify(itme))
					})
				},
		async	teacher_list(){
				if(this.panduan_num == 2){
					this.triggered = true
				}
				const res = await this.$myRequest({
					url:"/masterInfo/queryListPage",
					data:{
						status:2,
						mechanism_id: this.mechanism_id,
						type: "teach_paypal",
						pageSize: 10,
						currentPage: this.currentPage
					}
				})
				if(res.code == 0){
					res.data.forEach((itme,index) => {
						if(itme.photo.indexOf("http") == -1){
							res.data.splice(index,1)
						}
					})
					if(res.data.length == 0 || res.data.length < 10){
						this.numb = 2
					}
					if(this.teacher_arr.length == 0){
						this.teacher_arr = res.data
					}else{
						this.teacher_arr = this.teacher_arr.concat(res.data)
					}
					this.triggered = false
				}
			},
			onReachBottom(){
				if(this.numb != 2){
					this.currentPage++
					this.teacher_list()
				}
			},
			go_tianjia(){
				uni.reLaunch({
					url:"/pages/Other/theages/theages"
				})
			}
			
		},
		onLoad() {
			try{
				let  val = uni.getStorageSync('userif_list')
				this.mechanism_id = val.mechanism_id
			}catch(e){}
			this.teacher_list()
		},
		onShow() {
			
		}
	}
</script>